layout-changes for shopping cart
							parent
							
								
									0173a9eb57
								
							
						
					
					
						commit
						9ea9523816
					
				|  | @ -76,6 +76,12 @@ msgstr "Status PG" | ||||||
| msgid "Quotation Date" | msgid "Quotation Date" | ||||||
| msgstr "Angebotsdatum" | msgstr "Angebotsdatum" | ||||||
| 
 | 
 | ||||||
|  | #. module: dp_custom | ||||||
|  | #: model:ir.ui.view,arch_db:dp_custom.view_sale_cart | ||||||
|  | #: model:ir.ui.view,arch_db:dp_custom.view_cart_tree | ||||||
|  | msgid "Switch" | ||||||
|  | msgstr "Wechseln" | ||||||
|  | 
 | ||||||
| #. module: dp_custom | #. module: dp_custom | ||||||
| #: selection:sale.cart,state:0 | #: selection:sale.cart,state:0 | ||||||
| msgid "Quotation Sent" | msgid "Quotation Sent" | ||||||
|  |  | ||||||
|  | @ -64,6 +64,14 @@ class SaleCart(models.Model): | ||||||
|     user_id = fields.Many2one('res.users', string = 'User') |     user_id = fields.Many2one('res.users', string = 'User') | ||||||
|     assembly_state = fields.Selection(ASSEMBLY_STATES, string="State PG") |     assembly_state = fields.Selection(ASSEMBLY_STATES, string="State PG") | ||||||
|     state = fields.Selection(order_states, string="State") |     state = fields.Selection(order_states, string="State") | ||||||
|  |     in_company = fields.Boolean(default=False,compute='_in_company',store=False) | ||||||
|  | 
 | ||||||
|  |     @api.multi | ||||||
|  |     def _in_company(self): | ||||||
|  |         sCompany = self.env.user.company_id | ||||||
|  |         for record in self: | ||||||
|  |             if record.company_id == sCompany: | ||||||
|  |                 record.in_company = True | ||||||
| 
 | 
 | ||||||
|     @api.model_cr |     @api.model_cr | ||||||
|     def init(self): |     def init(self): | ||||||
|  | @ -86,6 +94,14 @@ class SaleCart(models.Model): | ||||||
|                                 WHERE so.state != 'cancel' AND so.origin != '' |                                 WHERE so.state != 'cancel' AND so.origin != '' | ||||||
|                                 """) |                                 """) | ||||||
| 
 | 
 | ||||||
|  |     @api.multi | ||||||
|  |     def switch_company(self): | ||||||
|  |         values = {'company_id': self.company_id.id} | ||||||
|  |         self.env.user.write(values) | ||||||
|  |         return { | ||||||
|  |             'type': 'ir.actions.client', | ||||||
|  |             'tag': 'reload_context', | ||||||
|  |         } | ||||||
| 
 | 
 | ||||||
| class SaleOrder(models.Model): | class SaleOrder(models.Model): | ||||||
|     _name = 'sale.order' |     _name = 'sale.order' | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ | ||||||
| 
 | 
 | ||||||
|     <record id="rule_cart_multi_company" model="res.groups"> |     <record id="rule_cart_multi_company" model="res.groups"> | ||||||
|         <field name="name">Shopping Cart multi-company</field> |         <field name="name">Shopping Cart multi-company</field> | ||||||
|         <field name="comment">Allows Listing of Shopping Carts in allowed multi-companies</field> |         <field name="comment">Provides List of Shopping Carts in assigned companies (multi-company)</field> | ||||||
| <!-- | <!-- | ||||||
|         <field name="model_id" ref="model_sale_cart"/> |         <field name="model_id" ref="model_sale_cart"/> | ||||||
|         <field name="groups" eval="[(4,ref('base.group_multi_company'))]"/> |         <field name="groups" eval="[(4,ref('base.group_multi_company'))]"/> | ||||||
|  |  | ||||||
|  | @ -320,18 +320,25 @@ | ||||||
|         <field name="arch" type="xml"> |         <field name="arch" type="xml"> | ||||||
|             <form string="Shopping Cart"> |             <form string="Shopping Cart"> | ||||||
|                 <group> |                 <group> | ||||||
|  |                     <field name="user_id" invisible="1"/> | ||||||
|  |                     <field name="in_company" invisible="1"/> | ||||||
|                     <field name="order_id" string="Quotation / Order"/> |                     <field name="order_id" string="Quotation / Order"/> | ||||||
| <!-- |  | ||||||
|                     <field name="name" string="Quotation Number"/> |  | ||||||
| --> |  | ||||||
|                     <field name="origin" string="Shopping Cart"/> |                     <field name="origin" string="Shopping Cart"/> | ||||||
|  |                     <label for="company_id"/> | ||||||
|  |                     <div name="company_id"> | ||||||
|  |                         <div> | ||||||
|  |                             <field name="company_id" string="Company" options="{'no_open':True}"/> | ||||||
|  |                             <button name="switch_company" type="object" string="Switch" | ||||||
|  |                                     class="btn btn-primary oe_read_only" | ||||||
|  |                                     attrs="{'invisible': [('in_company','=',True)]}" | ||||||
|  |                                     style="margin-left:20px;"/> | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|                     <field name="client_order_ref" string="Customer Reference"/> |                     <field name="client_order_ref" string="Customer Reference"/> | ||||||
|                     <field name="date_order" string="Quotation Date"/> |                     <field name="date_order" string="Quotation Date"/> | ||||||
|                     <field name="partner_id" string="Customer" options="{'no_open':True}"/> |                     <field name="partner_id" string="Customer" options="{'no_open':True}"/> | ||||||
|                     <field name="company_id" string="Company" options="{'no_open':True}"/> |  | ||||||
|                     <field name="state" string="State" options="{'no_open':True}"/> |                     <field name="state" string="State" options="{'no_open':True}"/> | ||||||
|                     <field name="assembly_state" string="State PG" options="{'no_open':[('company_id','!=',1)]}"/> |                     <field name="assembly_state" string="State PG" options="{'no_open':True}"/> | ||||||
|                     <field name="user_id" invisible="1"/> |  | ||||||
|                 </group> |                 </group> | ||||||
|             </form> |             </form> | ||||||
|         </field> |         </field> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue