Revert "[IMP] Sale: Make demo data 'Deposit' invisible to the user + invoice wizard cleaning"
This reverts commit 09cd1ab280.
That's Not How It Works, That's Not How Any Of This Works.
Conflicts:
addons/sale/res_config.py
This commit is contained in:
@@ -595,7 +595,7 @@
|
||||
<record id="product.product_product_57" model="product.product"> <field name="available_in_pos" eval="False"/> </record>
|
||||
<record id="product.product_product_58" model="product.product"> <field name="available_in_pos" eval="False"/> </record>
|
||||
<record id="product.product_product_59" model="product.product"> <field name="available_in_pos" eval="False"/> </record>
|
||||
<record id="sale.advance_product_1" model="product.template"> <field name="available_in_pos" eval="False"/> </record>
|
||||
<record id="sale.advance_product_0" model="product.product"> <field name="available_in_pos" eval="False"/> </record>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<field name='product_variant_count' invisible='1'/>
|
||||
<field name="id" invisible="True"/>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="toggle_active" type="object"
|
||||
<button name="toggle_active" type="object" groups="base.group_no_one"
|
||||
class="oe_stat_button" icon="fa-archive">
|
||||
<field name="active" widget="boolean_button"
|
||||
options='{"terminology": "archive"}'/>
|
||||
|
||||
@@ -64,15 +64,7 @@ class sale_configuration(osv.TransientModel):
|
||||
('order', 'Invoice ordered quantities'),
|
||||
('delivery', 'Invoice delivered quantities'),
|
||||
('cost', 'Invoice based on costs (time and material, expenses)')
|
||||
], 'Default Invoicing', default_model='product.template'),
|
||||
'deposit_property_account_income_id': fields.property(
|
||||
type="many2one",
|
||||
relation="account.account",
|
||||
string="Income Account",
|
||||
domain=[('deprecated', '=', False)],
|
||||
help="This account will be used for invoices instead of the default one to value sales for the deposit."),
|
||||
'deposit_taxes_ids': fields.many2many('account.tax', 'product_taxes_rel', 'prod_id', 'tax_id', string='Customer Taxes',
|
||||
domain=[('type_tax_use', '=', 'sale')]),
|
||||
], 'Default Invoicing', default_model='product.template')
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
@@ -92,23 +84,6 @@ class sale_configuration(osv.TransientModel):
|
||||
return {'value': {'group_pricelist_item': True, 'group_sale_pricelist': True, 'group_product_pricelist': False}}
|
||||
return {'value': {'group_pricelist_item': False, 'group_sale_pricelist': False, 'group_product_pricelist': False}}
|
||||
|
||||
def get_default_deposit_values(self, cr, uid, fields, context=None):
|
||||
deposit_product_template = self.pool['ir.model.data'].xmlid_to_object(cr, uid, 'sale.advance_product_1', context=context)
|
||||
return {
|
||||
'deposit_property_account_income_id': deposit_product_template.product_variant_ids.property_account_income_id.id \
|
||||
or deposit_product_template.product_variant_ids.categ_id.property_account_income_categ_id.id,
|
||||
'deposit_taxes_ids': deposit_product_template.product_variant_ids.taxes_id.ids
|
||||
}
|
||||
|
||||
def set_deposit_values(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
config_value = self.browse(cr, uid, ids, context=context)
|
||||
deposit_product_template = self.pool['ir.model.data'].xmlid_to_object(cr, uid, 'sale.advance_product_1', context=context)
|
||||
deposit_product_template.product_variant_ids.write({
|
||||
'property_account_income_id': config_value.deposit_property_account_income_id.id,
|
||||
'taxes_id': [(6, 0, config_value.deposit_taxes_ids.ids)],
|
||||
})
|
||||
|
||||
class account_config_settings(osv.osv_memory):
|
||||
_inherit = 'account.config.settings'
|
||||
|
||||
@@ -29,12 +29,6 @@
|
||||
<field name="group_product_pricelist" class="oe_inline" invisible="1"/>
|
||||
</div>
|
||||
</group>
|
||||
<group string="Deposit" name="deposit" id="deposit">
|
||||
<group>
|
||||
<field name="deposit_property_account_income_id"/>
|
||||
<field name="deposit_taxes_ids" widget="many2many_tags"/>
|
||||
</group>
|
||||
</group>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -74,20 +74,5 @@
|
||||
<field name="relation_field">team_id</field>
|
||||
</record>
|
||||
|
||||
<!-- Deposit product.. -->
|
||||
<record id="advance_product_1" model="product.template">
|
||||
<field name="name">Deposit</field>
|
||||
<field name="categ_id" ref="product.product_category_1"/>
|
||||
<field name="type">service</field>
|
||||
<field name="list_price">150.0</field>
|
||||
<field name="invoice_policy">order</field>
|
||||
<field name="standard_price">100.0</field>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product.product_uom_unit"/>
|
||||
<field name="company_id" eval="[]"/>
|
||||
<field name="image" type="base64" file="sale/static/img/advance_product_0-image.jpg"/>
|
||||
<field name="active" eval="False"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -313,6 +313,21 @@ Thanks!</field>
|
||||
<field name="message_type">comment</field>
|
||||
<field name="author_id" ref="base.partner_demo"/>
|
||||
</record>
|
||||
<!-- sale advance demo.. -->
|
||||
<!-- Demo Data for Product -->
|
||||
|
||||
<record id="advance_product_0" model="product.product">
|
||||
<field name="name">Deposit</field>
|
||||
<field name="categ_id" ref="product.product_category_1"/>
|
||||
<field name="type">service</field>
|
||||
<field name="list_price">150.0</field>
|
||||
<field name="invoice_policy">order</field>
|
||||
<field name="standard_price">100.0</field>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field name="uom_po_id" ref="product.product_uom_unit"/>
|
||||
<field name="company_id" eval="[]"/>
|
||||
<field name="image" type="base64" file="sale/static/img/advance_product_0-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="base.user_demo" model="res.users">
|
||||
<field eval="[(4, ref('base.group_sale_salesman'))]" name="groups_id"/>
|
||||
|
||||
@@ -29,7 +29,7 @@ class TestSale(TestMail):
|
||||
account_recv_id = account_obj.create({'code': 'X1012', 'name': 'Sales - Test Reicv Account', 'user_type_id': user_type_id, 'reconcile': True})
|
||||
|
||||
# Add account to product
|
||||
product_template_id = self.env.ref('sale.advance_product_1')
|
||||
product_template_id = self.env.ref('sale.advance_product_0').product_tmpl_id
|
||||
product_template_id.write({'property_account_income_id': account_rev_id})
|
||||
|
||||
# Create Sale Journal
|
||||
|
||||
@@ -26,8 +26,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
@api.model
|
||||
def _get_advance_product(self):
|
||||
try:
|
||||
deposit_product_template = self.env['ir.model.data'].xmlid_to_object('sale.advance_product_1', raise_if_not_found=True)
|
||||
return deposit_product_template.product_variant_ids.ids[0]
|
||||
return self.env['ir.model.data'].xmlid_to_res_id('sale.advance_product_0', raise_if_not_found=True)
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
@@ -40,17 +39,6 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
product_id = fields.Many2one('product.product', string='Deposit Product', domain=[('type', '=', 'service')], default=_get_advance_product)
|
||||
count = fields.Integer(default=_count, string='# of Orders')
|
||||
amount = fields.Float('Deposit Amount', digits=dp.get_precision('Account'), help="The amount to be invoiced in advance, taxes excluded.")
|
||||
deposit_property_account_income_id = fields.Many2one(
|
||||
related="product_id.property_account_income_id",
|
||||
relation="account.account",
|
||||
string="Income Account",
|
||||
domain=[('deprecated', '=', False)],
|
||||
help="This account will be used for invoices instead of the default one to value sales for the deposit.")
|
||||
deposit_taxes_ids = fields.Many2many(
|
||||
related="product_id.taxes_id",
|
||||
string='Customer Taxes',
|
||||
domain=[('type_tax_use', '=', 'sale')])
|
||||
|
||||
|
||||
@api.onchange('advance_payment_method')
|
||||
def onchange_advance_payment_method(self):
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
attrs="{'invisible': [('count','>',1)]}"/>
|
||||
<field name="product_id"
|
||||
context="{'search_default_services': 1, 'default_type': 'service', 'default_invoice_policy': 'order'}" class="oe_inline"
|
||||
invisible="1"/>
|
||||
<field name="deposit_property_account_income_id" attrs="{'invisible': [('advance_payment_method','not in', ('fixed','percentage'))]}" class="oe_inline"/>
|
||||
<field name="deposit_taxes_ids" widget="many2many_tags" attrs="{'invisible': [('advance_payment_method','not in', ('fixed','percentage'))]}" class="oe_inline"/>
|
||||
attrs="{'invisible': [('advance_payment_method','not in', ('fixed','percentage'))]}"/>
|
||||
<label for="amount" attrs="{'invisible': [('advance_payment_method', 'not in', ('fixed','percentage'))]}"/>
|
||||
<div attrs="{'invisible': [('advance_payment_method', 'not in', ('fixed','percentage'))]}">
|
||||
<field name="amount"
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<!--Resource: sale.order.line for services type product-->
|
||||
|
||||
<record id="line_services" model="sale.order.line">
|
||||
<field name="order_id" ref="sale.sale_order_3"/>
|
||||
<field name="name">Advance</field>
|
||||
<field name="product_id" ref="sale.advance_product_0"/>
|
||||
<field name="product_uom" ref="product.product_uom_day"/>
|
||||
<field name="price_unit">150.0</field>
|
||||
<field name="product_uom_qty">5.0</field>
|
||||
</record>
|
||||
|
||||
<record id="project.project_stage_2" model="project.task.type">
|
||||
<field name="closed" eval="True"/>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user